package com.zde.morilive.live;

import com.aizuda.zlm4j.core.ZLMApi;
import com.sun.jna.Native;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

/**
 * 直播模块配置
 */
@Configuration
@Slf4j
public class LiveConfig {
    public static ZLMApi ZLM_API = Native.load("mk_api", ZLMApi.class);

    /**
     * 在spring进行ioc（依赖注入）之后会自动调用这个方法的标记注解
     */
    @PostConstruct
    public void init(){
        log.info("----------------开始直播监听--------------");
        //初始化sdk配置 SDK参数配置详见ZLM4J参数配置
        ZLM_API.mk_env_init2(1, 1, 1, null, 0, 0, null, 0, null, null);
        //http
        short http_server_port = ZLM_API.mk_http_server_start((short) 7788, 0);
        //rtsp
        short rtsp_server_port = ZLM_API.mk_rtsp_server_start((short) 554, 0);
        //rtmp
        short rtmp_server_port = ZLM_API.mk_rtmp_server_start((short) 1935, 0);

    }
}
